﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sayeet
{
    public class Chat
    {
        public ChatPane pane;
        public bool visible = false;
        public RosterItem contact;
        AppData appData;

        public Chat(RosterItem cont, AppData ap)
        {
            contact = cont;
            appData = ap;
            createPane();
            
            appData.debugWindow.addText("Chat with " + cont.Jid + " started.");
        }

        public void createPane()
        {
            pane = new ChatPane();
            pane.ToAddress = contact.Jid.ToStringWithoutResource();
            pane.FromAddress = appData.myJid.ToString(); ;
            pane.Name = contact.Name;
            pane.chat = this;
            appData.chatWindow.addTab(pane);
        }

        public void closeChat()
        {
            contact.ActiveChat = null;
        }
    }
}
